﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>微街秀 > 提现</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no" />
    <link href="plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="css/css.css" />
    <link href="css/Makezfbset.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery-2.1.4.min.js" type="text/javascript"></script>
    <script src="plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
    <script src="js/ajax-data.js" type="text/javascript"></script>
    <script src="js/base.js" type="text/javascript"></script>
    <script src="js/dialog.js" type="text/javascript"></script>
    <script src="js/gl-dialog.js" type="text/javascript"></script>
    <style>
        #headimg
        {
            height: 70px;
            border-radius: 100px;
        }
    </style>
</head>
<body>
    <div>
        <input type="hidden" id="refID" value="0" />
        
        <div class="wamtop">
            <div class="topleft back" onclick="GoBack()">
                <img src="img/5.jpg" />
            </div>

            <div class="topcententxt">
            </div>

            
        </div>
        <div class="nickname" style="margin-top: 10%">
            <input type="number" class="nicknametext" id="amount" placeholder="请输入金额（元）" />
        </div>
        <div style="width: 93%; margin-left: auto; margin-right: auto; padding-top: 5px;
            color: #999;">
            <span style="font-size: 80%;float: left">最低提现额度50</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span  style="font-weight: bold; color: chocolate;float: right">余额：<span id="balance">0.00</span>元</span> 
            </div>
            
        <div class="nicksave" style="margin-top: 30%">
            <div class="submits" style="font-size: 16px; color: White;">
                确定</div>
        </div>
    </div>

    
    <script>
        var openid = "", platform, balance, type;
        $(document).ready(function () {
            loadParam();
            if (!islogin()) { window.location.href = 'login.html'; return; }
           
            $(".submits").bind("click", submits);
            
        });

        function loadParam() {
            type = getQueryString("type");          //1 广告主, 2 分享者
            platform = getQueryString("platform");  //1 微信，2 支付宝
            if (getQueryString("balance") != null) {
                balance = getQueryString("balance");
            }
            $("#balance").html(balance);
            if (platform == "1") {
                $(".topcententxt").html("申请微信提现");
            }
            
        }

        function submits() {
            var amount = $("#amount").val();
            if (trim(amount) == "") {
                Alert("请输入金额");
                return false;
            }
            if (isNaN(amount) || parseFloat(amount) < 50) {
                Alert("满50才可以提现");
                return false;
            }
            if (!isNaN(balance)) {
                if (parseFloat(amount) > parseFloat(balance)) {
                    Alert("最多允许提现" + balance + "元");
                    return false;
                }
            }
            

            if (platform == "1") {
                if (!confirm("请确认提现信息：\n提现平台:微信钱包\n提现金额:" + amount + "元"))
                    return false;
            }
            
            AjaxStart("ajax/fc_cash.ashx?add", "&platform=" + platform + "&amount=" + amount + "&type=" + type, function (data) {
                if (data.code == 0) {
                    $("#amount").val("");
                    var s = trim($("#balance").html());
                    if (!isNaN(s)) {
                        balance = parseFloat(s) - parseFloat(amount);
                        if (balance < 0) balance = 0;
                        $("#balance").html(balance.toFixed(2));
                    }
                    Alert("申请成功，1个工作日内钱会转入您的账户");
                }
                else if (data.code == 1012) {
                    //没有验证手机号
                    GlAlert({ body: "请先验证手机号,立即验证?", ok: { callback: function () { window.location.href = "validate-phone.html"; }
                    },
                        cancel: {}
                    });
                }
                else
                    Alert(data.msg);
            });
        }
        function GoBack() {
            if (type == 1)
                window.location.href = 'Makead_1.html';
            else
                window.location.href = 'Makesh_3.html';
        }
        
    </script>
</body>
</html>
